home *** CD-ROM | disk | FTP | other *** search
- @echo off
- ! deldir1.bat TO BE EXECUTED VIA DELDIR.BAT AND NEVER DIRECTLY
- ! %1: name of source subdirectory within the current directory
- ! %2: file ID to be restored to the variable deldir1_fileID before returning
- ! Copyright © 1994 by Rainbow Hill Pty Ltd. All rights reserved.
-
- ! ensure that deldir1 is being called from within deldir.bat
- if "%deldir_back%" == %%DELDIR_BACK%% goto NO_DELDIR_LBL
-
- onerror DONE_LBL
-
- ! attach to the folder to be deleted
- cd "%1"
-
- onerror DELFILE_LBL
-
- ! prepare a file with the list of all subdirectories
- set deldir1_fileID=no value at all
- dir/b/a-f > DELDIR_TEMPTFILE
-
- set doserr=0
-
- ! open the file containing the list of all subdirectories
- open DELDIR_TEMPTFILE deldir1_fileID
-
- :DELDIR1_LOOP_LBL
-
- ! obtain a folder name (it will jump to DELFILE_LBL on EOF)
- read %deldir1_fileID% deldir1_aDir
-
- ! remove the double quotes which enclose the name
- decr -deldir1_aDir
- decr deldir1_aDir
-
- ! execute deldir1 recursively to delete the subdirectory
- call deldir1 "%deldir1_aDir%" %deldir1_fileID%
-
- ! loop back
- goto DELDIR1_LOOP_LBL
-
- :NO_DELDIR_LBL
- echo.
- echo deldir1 should be called from within deldir.bat and never executed directly.
- echo.
- goto RETURN_LBL
-
- :DELFILE_LBL
- onerror
- close %deldir1_fileID%
- del *
- if %doserr% == 27 set doserr=0
- if %doserr% == 3 set doserr=0
- :DONE_LBL
- onerror RETURN_LBL
- set deldir1_fileID=%2
- set deldir1_aDir=
- cd ..
- rd "%1"
- :RETURN_LBL
-